<?php 
class TalentModel extends BaseModel {
	public function list_talent($cid){
		//已下载的简历不显示在人才库中
		$rid = D('company_resume')->where('cid ='.$cid)->getField('rid',true);
		if($rid !=""){
			$map['resume_id']  = array('not in',$rid);
		}
		$map['zhuangtai'] = 1;
		$san = time()-24*60*60*7;
		$map['ctime'] = array('egt',$san);
		/*$map['complate'] = 1;*/
		$map['isOpen'] = 1;
		$talent = D('resume')->where($map)->order('ctime desc')->findPage('9'); 
		foreach($talent['data'] as $k => &$v){
			$info = D('member_info')->where('uid = '.$v['uid'])->find();
			$info['face'] = get_img_url($info['face']);
			$v = array_merge($v,$info);
			$v['exper'] = D('exper')->where('uid = '.$v['uid'])->select();
		}
		return $talent;
	}
	public function download_resume($resume_id,$cid){
		$data = array(
					'cid' => $cid,
					'rid' => $resume_id,
					'dateline' => time()
				);
		$result = D('company_resume')->add($data);
		if($result){
			return true;
		}else{
			return false;
		}
	}

	public function find_phone($rid){
		$uid = D('resume')->where(array('resume_id'=>$rid))->getField('uid');
		$phone = D('member_info')->where(array('uid'=>$uid))->getField('phone');
		return $phone;
	}
}
?>